package com.bestvike.stone.spring.stream.core;

import com.bestvike.stone.core.reflect.ReflectionUtils;
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
import org.springframework.messaging.handler.invocation.InvocableHandlerMethod;

import java.lang.reflect.Method;

/**
 * Created by 许崇雷 on 2018-09-04.
 */
public final class StreamMessageHandlerMethodFactory extends DefaultMessageHandlerMethodFactory {
    @Override
    public InvocableHandlerMethod createInvocableHandlerMethod(Object bean, Method method) {
        InvocableHandlerMethod handlerMethod = new StreamInvocableHandlerMethod(bean, method);
        handlerMethod.setMessageMethodArgumentResolvers(ReflectionUtils.getFieldValue(this, "argumentResolvers"));//设置反序列化转换器
        return handlerMethod;
    }
}
